﻿/// <reference path="jquery-1.3.2.min.js" />

//鼠标进入单元格
function fnMouseover(td) {
    /*移出所有单元格的选中状态效果*/
    //设置当前单元格背景图片
    $("#tblNavi td").css("background", "url('Images/bg_unsele.jpg') no-repeat bottom");
    //设置当前单元格内SPAN标记的字体颜色
    $("#tblNavi td span").css("color", "rgb(90,196,241)"); //等同于：$("#tblNavi td").contents("span").css("color", "rgb(90,196,241)");

    /*设置当前鼠标指向单元格的效果*/
    //设置当前单元格背景图片
    $(td).css("background", "url('Images/bg_sele.jpg') no-repeat bottom");
    //设置当前单元格内SPAN标记的字体颜色
    $(td).contents("span").css("color", "White");

    //调整子菜单显示位置
    $("#childMenu").css("left", $(td).position().left + 22);
    $("#childMenu").css("top", $("#tdCMenu").position().top);
    //获取当前单元格id
    var tdId = $(td).attr("id");
    //调用方法加载其下子菜单
    fnLoadChildMenu(tdId);
}

/*链接地址*/
//院系管理页
var yx = "yxPage.aspx";
//主页
var home = "homePage.aspx";
//专业管理页
var zy = "zyPage.aspx";
//人员管理页
var ry = "ryPage.aspx";
//科目管理页
var km = "kmPage.aspx";
//试卷管理页
var ExamDesign = "ExamDesign.aspx";
//试题管理页
var ques = "QuesPage.aspx";
//公告管理页
var gg = onclick = "ggPage.aspx";
var qtQues = "qtQuesPage.aspx";
//班级管理页
var bj = "bjPage.aspx";
//班级学生管理页
var xs = "xsPage.aspx";
//老师成绩查询
var tcx = "cjPage.aspx";
//我要考试
var ksEntry = "examKnow.aspx";
//我的成绩单
var myCJ = "myCJForm.aspx";


//加载指定菜单下的子菜单
function fnLoadChildMenu(paraentNote) {

    switch (paraentNote) {
        //首页子菜单为空         
        case "tdHome": $("#childMenu").html(""); break;
        //加载院系管理子菜单  
        case "tdYX": $("#childMenu").html("<span onclick='fnLoadPage(yx)'>院系管理</span><span onclick='fnLoadPage(zy)'>专业管理</span><span onclick='fnLoadPage(ry)'>人员管理</span>"); break;
        //加载科目管理子菜单 
        case "tdKM": $("#childMenu").html("<span onclick='fnLoadPage(km)'>科目管理</span><span onclick='fnLoadPage(ExamDesign)'>试卷设计</span>"); break;
        //加载题库管理子菜单 
        case "tdTK": $("#childMenu").html("<span onclick='fnLoadPage(ques)'>所有试题管理</span>"); break;
        //成绩子菜单为空 
        case "tdCJ": $("#childMenu").html("<span onclick='fnLoadPage(tcx)'>查询我的班级或学生成绩</span>"); break;
        //加载班级管理子菜单  
        case "tdBJ": $("#childMenu").html("<span onclick='fnLoadPage(bj)'>班级信息管理</span>"); break;
        //加载班级学生子菜单  
        case "tdXS": $("#childMenu").html("<span onclick='fnLoadPage(xs)'>学生信息管理</span>"); break;
        //学生查询菜单 
        case "tdXSCX": $("#childMenu").html("<span onclick='fnLoadPage(myCJ)'>我的成绩单</span>"); break;
        //学生考试菜单 
        case "tdXSKS": $("#childMenu").html("<span onclick='fnLoadPage(ksEntry)'>立马去考试</span>"); break;
        //公告子菜单为空 
        case "tdGG": $("#childMenu").html("<span onclick='fnLoadPage(gg)'>系统公告管理</span>"); break;
    }
}

//改变框架高度
function fnChangeHeight() {
    var ifra = document.getElementById("ifraPage");
    if (ifra.contentDocument) {
        //IE8以上及FF
        ifra.height = ifra.contentDocument.body.scrollHeight + 15;
        if (ifra.height > 510) {
            $("#divContL").height(ifra.height);
        }
        else {
            $("#divContL").height(510);
        }

    }
    else {
        //IE8以下
        ifra.height = ifra.contentWindow.document.body.clientHeight + 15;
        if (ifra.height > 510) {
            $("#divContL").height(ifra.height);
        }
        else {
            $("#divContL").height(510);
        }
    }
}

//为框架加载内容
function fnLoadPage(pageUrl) {
    $("#ifraPage").attr("src", pageUrl);
}

//显示管理员菜单
function fnShowManaMenu() {
    $("#tblNavi td").hide();
    $("#tdHome").show();
    $("#tdYX").show();
    $("#tdBJ").show();
    $("#tdKM").show();
    $("#tdTK").show();
    $("#tdGG").show();
}

//显示辅导员菜单
function fnShowFDYMenu() {
    $("#tblNavi td").hide();
    $("#tdHome").show();
    $("#tdBJ").show();
    $("#tdXS").show();
    $("#tdCJ").show();
}

//显示学生菜单
function fnShowXSMenu() {
    $("#tblNavi td").hide();
    $("#tdHome").show();
    $("#tdXSCX").show();
    $("#tdXSKS").show();
}

/*时间*/
function fnShowTime() {
    //获取用于显示时间的控件
    var oRun = document.getElementById("ShowTime");
    //处理时间字符串
    var nowTime = new Date();
    var yy = nowTime.getFullYear() + '年';
    var mm = (nowTime.getMonth() + 1) + '月';
    var dd = nowTime.getDate() + '日';
    var nowHour = nowTime.getHours();
    var nowMinu = nowTime.getMinutes();
    var nowSeco = nowTime.getSeconds();
    var sTime = nowHour + ':' + nowMinu + ':' + nowSeco;
    var week;
    switch (nowTime.getDay()) {
        case 1: week = '星期一'; break;
        case 2: week = '星期二'; break;
        case 3: week = '星期三'; break;
        case 4: week = '星期四'; break;
        case 5: week = '星期五'; break;
        case 6: week = '星期六'; break;
        case 0: week = '星期日'; break;
    }
    try {
        oRun.innerHTML = yy + mm + dd + ' ' + week + ' ' + sTime;
    }
    catch (exception) { }
}
setInterval(fnShowTime, 500);